<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <link rel="icon" href="/favicon.ico" />
  <title>新爵士</title>
  <!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->
  <!-- CDN方式引入 Vue3 -->
  <script src="https://unpkg.com/vue@3"></script>

  <!--根据获取到的数据动态引用组件链接-->
  <script src="./editor/dist-adcomponent.js"></script>
  <script src="./editor/dist-bottomcomponent.js"></script>
  <script src="./editor/dist-productcomponent.js"></script>
  <script src="./editor/dist-topcomponent.js"></script>
  <!--[if lt IE 11
      ]><script>
        window.location.href='/html/ie.html';
      </script><!
    [endif]-->
  <style>
    html,
    body,
    #app {
      height: 100%;
      margin: 0px;
      padding: 0px;
    }
  </style>

</head>

<body>
  <div id="app">
    <div>
      <component :is="item.name" :data="item.data" v-for="(item, index) in data" :key="index"/>
    </div>
  </div>

  <script>
    const { createApp, ref } = Vue

    var app = createApp({
      setup() {
        // 定义组件名称以及data
        const data = ref([
          {
            // name: 'top-component',
            name: 'top-component',
            data: {}
          },
          {
            name: 'ad-component',
            data: {}
          },
          {
            name: 'bottom-component',
            data: {}
          },
          {
            name: 'product-component',
            data: {}
          },
        ]);
        return {
          data
        }
      }
    })

    // 需要根据获取到的网站组件列表动态生成如下代码
    // 此处代码为组件注册
    app.component('top-component', TopComponent);
    app.component('ad-component', AdComponent);
    app.component('bottom-component', BottomComponent);
    app.component('product-component', ProductComponent);

    app.mount('#app')
  </script>
</body>

</html>
